package bean;

import java.util.Objects;

//bean实体类，bean对象没有任何业务逻辑，所有属性全部私有，提供getter,setter
public class Express {
    private String number;//快递单号
    private String company;//快递公司
    private int code;  //取件码

    public Express() { }

    public Express(String number, String company, int code) {
        this.number = number;
        this.company = company;
        this.code = code;
    }

    public String getNumber() { return number; }

    public void setNumber(String number) { this.number = number;}

    public String getCompany() {  return company; }

    public void setCompany(String company) { this.company = company;}

    public int getCode() {  return code; }

    public void setCode(int code) { this.code = code; }

    @Override
    public String toString() {
        return "Exprerss{" +
                "number='" + number + '\'' +
                ", company='" + company + '\'' +
                ", code=" + code +
                '}';
    }

    //比较依据:快递单号
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Express express = (Express) o;
        return Objects.equals(number, express.number);
    }

    @Override
    public int hashCode() { return Objects.hash(number); }
}
